//Generates alternative version of figure 5 using PIPS data.

set more off

clear all

use "$rawData/incFinalMonthlyPIPS.dta", clear

set scheme s1mono

keep incidents totCas monyr distn qtryr

reshape wide incidents totCas, i(monyr) j(distn)

global d1 "Bajaur"
global d2 "Khyber"
global d3 "Kurram"
global d4 "Mohmand"
global d5 "NWA"
global d6 "Orakzai"
global d7 "SWA"

label variable monyr "Time"

line incidents1 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon1) title($d1, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line incidents2 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon2) title($d2, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line incidents3 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon3) title($d3, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line incidents4 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon4) title($d4, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line incidents5 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon5) title($d5, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line incidents6 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon6) title($d6, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line incidents7 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(incMon7) title($d7, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))

//Output Figure 11 from supplement.
gr combine incMon1 incMon2 incMon3 incMon4 incMon5 incMon6 incMon7, r(3) subtitle("Insurgent Attacks per Month")
gr export figures/incMonPIPS.pdf, replace

line totCas1 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon1) title($d1, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line totCas2 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon2) title($d2, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line totCas3 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon3) title($d3, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line totCas4 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon4) title($d4, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line totCas5 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon5) title($d5, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line totCas6 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon6) title($d6, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))
line totCas7 monyr, xline(576, lp(shortdash)) ytitle("") ylabel(, angle(0) labsize(small)) nodraw name(casMon7) title($d7, size(medium)) xlabel(564 "2007" 576 "2008" 588 "2009" 600 "2010" 612 "2011" 624 "2012" 636 "2013", angle(45) labsize(small))

//Output Figure 12 from supplement.
gr combine casMon1 casMon2 casMon3 casMon4 casMon5 casMon6 casMon7, r(3) subtitle("Casualties per Month")
gr export figures/casMonPIPS.pdf, replace
